from base.base import Base
from selenium.webdriver.common.by import By
from time import sleep

class SousuoPage(Base):
    sousuokuang=(By.XPATH,'/hierarchy/android.widget.FrameLayout/android.widget.LinearLayout/android.widget.FrameLayout/android.widget.RelativeLayout/android.widget.FrameLayout[1]/android.widget.RelativeLayout/android.widget.FrameLayout[2]/android.widget.RelativeLayout/android.widget.ViewSwitcher/android.widget.RelativeLayout')

    shurukuang=(By.ID,'com.achievo.vipshop:id/search_text_view')

    sousuoanniu='new UiSelector().resourceId("com.achievo.vipshop:id/tv_search")'

    xiaoliang=(By.ID,'com.achievo.vipshop:id/text_sales_volume')

    dy1=(By.XPATH,'//android.widget.TextView[@text="361° 【商家畅销款】网面透气舒适包裹男式跑鞋缓震耐磨软弹运动鞋男鞋"]')

    dy2=(By.XPATH,'//android.widget.TextView[@text="回力 【春季热卖】运动鞋休闲鞋舒适透气男鞋耐磨减震跑步鞋女健步鞋"]')

    def sousuoyewu(self,password):
        self.loc_ele(self.sousuokuang).click()
        sleep(2)

        self.loc_ele(self.shurukuang).send_keys(password)
        sleep(2)

        self.loc_ui_ele(self.sousuoanniu).click()
        sleep(2)

        self.loc_ele(self.xiaoliang).click()
        sleep(2)